package com.ciei.dpagm.controller;

import com.alibaba.fastjson.JSONObject;
import com.ciei.dpagm.common.controller.BaseController;
import com.ciei.dpagm.service.DriverLibraryConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangyan
 * @date 2023/05/08
 */
@RestController
@RequestMapping("driverLibraryConfig")
public class DriverLibraryConfigController extends BaseController {

    @Autowired
    private DriverLibraryConfigService driverLibraryConfigService;

    @RequestMapping("loadConfig")
    public JSONObject loadConfig(@RequestBody JSONObject data) {
        return driverLibraryConfigService.loadConfig(data);
    }

    @RequiresPermissions({"driverLibraryManagement:driverLibrary:projectFileSetHHeaderDirectory","driverLibraryManagement:driverLibrary:projectFileSetCSourceDirectory","driverLibraryManagement:driverLibrary:projectFileSetTemplateFile","driverLibraryManagement:driverLibrary:projectFileSetDocumentationSourceDirectory","driverLibraryManagement:driverLibrary:projectFileSetOtherDriverFile"})
    @RequestMapping("add")
    public JSONObject add(@RequestBody JSONObject data) {
        return driverLibraryConfigService.add(data);
    }

    @RequiresPermissions({"driverLibraryManagement:driverLibrary:projectFileCancelHHeaderDirectorySet","driverLibraryManagement:driverLibrary:projectFileCancelCSourceDirectorySet","driverLibraryManagement:driverLibrary:projectFileCancelTemplateFileSet","driverLibraryManagement:driverLibrary:projectFileCancelDocumentationDirectorySet","driverLibraryManagement:driverLibrary:projectFileCancelOtherDriverFileSet"})
    @RequestMapping("delete")
    public JSONObject delete(@RequestBody JSONObject data) {
        return driverLibraryConfigService.delete(data);
    }


}
